package com.zyw.codegen;

import org.mybatis.generator.api.ProgressCallback;

/**
 * @author zhangyw
 * @date 2017/3/14 15:04
 */
public class GeneratorContextHolder {

    private static final ThreadLocal<ProgressCallback> scb = new ThreadLocal<ProgressCallback>();
    private static final ThreadLocal<GenConfig> gcf = new ThreadLocal<GenConfig>();

    public static ProgressCallback getProgressCallback(){
        return scb.get();
    }

    public static void setProgressCallback(ProgressCallback callback){
        scb.set(callback);
    }

    public static GenConfig genConfig(){
        return gcf.get();
    }

    public static void setGenConfig(GenConfig config){
        gcf.set(config);
    }

    public static void clear(){
        scb.remove();
        gcf.remove();
    }
}
